<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>Mesa Demos Distribution</title>
  <style type="text/css">
    <!--
    pre { background: #cccccc; }
	-->
  </style>
</head>
<body>

<h1>Introduction</h1>
<p>
The Mesa Demos package contains a large number of OpenGL demonstration
and test programs.
</p>

<p>
These programs were previously distributed as the MesaDemos-x.y.z.tar.gz
package released in conjunction with the MesaLib-x.y.z.tar.gz package.
The demos are separated now since they don't change often and
aren't tied to a particular version of Mesa.
</p>

<p>
Note that the Mesa demos should be usable with any OpenGL implementation;
not just Mesa.
</p>


<h1>FTP site</h1>

<p>
The latest version of the Mesa demos can be found on the
<a href="ftp://ftp.freedesktop.org/pub/mesa/demos/">freedesktop.org FTP</a>
site.
</p>



<h1>Git Repository</h1>

<p>
The Mesa demos git repository can be obtained with:
</p>
<pre>
git clone git://anongit.freedesktop.org/git/mesa/demos
</pre>

<p>
Or, if you're a developer:
</p>
<pre>
git clone git+ssh://USERNAME@git.freedesktop.org/git/mesa/demos
</pre>


<h1>Building</h1>

<p>
The Mesa demos can be built with autoconf or <a href="http://www.cmake.org/">CMake</a>.
</p>


<h2>Prerequisites</h2>

<p>
You'll need <a href="http://glew.sourceforge.net/">glew</a> version 1.5.4
or later and glut or <a href="http://freeglut.sourceforge.net/">freeglut</a> (runtime libraries and header files).
</p>

<p>
If you're using an RPM-based Linux distro you can install these items with:
</p>
<pre>
yum install glew glew-devel
yum install freeglut freeglut-devel
</pre>

<p>
And if you're using a Debian based Linux distro you can install these items with:
</p>
<pre>
apt-get install libglew-dev freeglut3-dev
</pre>



<h2>Autoconf</h2>

<p>
Run <b>./configure --help</b> to see the options available for building
the demos.
</p>

<p>
Otherwise, just run <b>./configure ; make</b> to build the demos.
</p>



<h2>CMake</h2>

<p>
See the <a href="http://www.cmake.org/cmake/help/documentation.html">CMake documentation</a> for more information about CMake.
</p>

<h3>Unix</h3>

<p>
Run:
</p>
<pre>
cmake .
make
</pre>

<h3>MSVC</h3>

<ul>
  <li>Start the CMake GUI.</li>
  <li>Specify where this source is and where to build the binaries.</li>
  <li>Click <i>Configure</i>.</li>
  <li>Specify where GLEW and GLUT headers and libraries are; specifically via the 
  <b>GLEW_INCLUDE_DIR</b>, <b>GLEW_glew_LIBRARY</b>, <b>GLUT_INCLUDE_DIR</b>, and <b>GLUT_glut_LIBRARY</b> variables.</li>
  <li>Click <i>Generate</i>.</li>
  <li>Open the generated <b>mesademos.sln</b> Visual Studio solution file and build the target <b>ALL</b>.
</ul>

<h3>MinGW cross-compilation</h3>

<p>
Create a <b>Toolchain.cmake</b> file containing:
</p>
<pre>
# the name of the target operating system
set (CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
set (CMAKE_C_COMPILER i586-mingw32msvc-gcc)
set (CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
set (CMAKE_RC_COMPILER i586-mingw32msvc-windres)

# here is the target environment located
set (CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
</pre>

<p>
Create a <b>Cache.cmake</b> file containing:
</p>
<pre>
set (GLEW_INCLUDE_DIR "/path/to/glew/include" CACHE PATH "" FORCE)
set (GLEW_glew_LIBRARY "/path/to/glew/lib/libglew32.a" CACHE FILEPATH "" FORCE)

set (GLUT_INCLUDE_DIR "/path/to/glut/include" CACHE PATH "" FORCE)
set (GLUT_glut_LIBRARY "/path/to/glut/lib/libglut32.a" CACHE FILEPATH "" FORCE)
</pre>

<p>
Then do:
</p>
<pre>
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=/path/to/Toolchain.cmake -C /path/to/Cache.cmake
make
make install
</pre>

<p>
Read <a href="http://www.vtk.org/Wiki/CmakeMingw">this</a> for more information about CMake and MinGW cross compilation.
</p>


<h1>The Demos</h1>

<p>
Look in the <b>src/</b> directory for these sub-directories, among others:
</p>
<ul>
  <li>demos - the original Mesa demos, such as gears, gloss, etc.</li>
  <li>redbook - the OpenGL Programming Guide demos</li>
  <li>samples- original SGI OpenGL demos</li>
  <li>glsl - OpenGL Shading Language demos</li>
  <li>gs - Geometry shader demos</li>
  <li>xdemos - GLX-based demos</li>
  <li>egl - EGL-based demos</li>
  <li>wgl - WGL-based demos</li>
  <li>fp - fragment program tests</li>
  <li>vp - vertex program tests</li>
  <li>data - data files used by the demos</li>
  <li>perf - performance tests</li>
  <li>tests - assorted test programs</li>
  <li>objviewer - program to view .obj modes with a skybox</li>
</ul>



<h1>Getting Help</h1>

<p>
If you have trouble building or using the Mesa demos, you can post
to the<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-users">
Mesa users</a> mailing list.
</p>

<p>
If your question is especially technical, you can try the
to the<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">
Mesa dev</a> mailing list.
</p>


<h1>Reporting Bugs</h1>

<p>
Bugs in the demos can be reported to the
<a href="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa">
Mesa bug database</a>.
Choose Component="Demos" in the drop-down list.
</p>


</body>
</html>
